using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using CSP.Model.CSP;

namespace CSP.DataAccess.Mapping
{
    public class SearchCacheMap : EntityTypeConfiguration<SearchCache>
    {
        public SearchCacheMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.CacheKey)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.SearchValue)
                .HasMaxLength(20);


            // Table & Column Mappings
            this.ToTable("SearchCache");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.CacheKey).HasColumnName("CacheKey");
            this.Property(t => t.SearchValue).HasColumnName("SearchValue");
            this.Property(t => t.ServiceArea).HasColumnName("ServiceArea");
            this.Property(t => t.AgeGroup).HasColumnName("AgeGroup");
            this.Property(t => t.ServiceType).HasColumnName("ServiceType");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
        }
    }
}
